

pub fn scope_and_shadowing_test() {
    // This binding lives in the main function
    let long_lived_binding = 1;
    println!("变量定义：long_lived_binding={} 在全作用域！", long_lived_binding);
    // This is a block, and has a smaller scope than the main function
    {
        println!("起始大括号{{");
        // This binding only exists in this block
        let short_lived_binding = 2;
        println!("变量定义：short_lived_binding={} 作用域就在大括号内侧！", short_lived_binding);

        println!("short_lived_binding inner short: {}", short_lived_binding);

        // This binding *shadows* the outer one
        let long_lived_binding = 5_f32;

        println!("short_lived_binding inner long: {}", long_lived_binding);

        println!("完结大括号}}");
    }
    // End of the block

    // Error! `short_lived_binding` doesn't exist in this scope
    println!("你用不了这个变量了：short_lived_binding，已经超出了它的作用域！");
    // FIXME ^ Comment out this line

    println!("long_lived_binding outer long: {}", long_lived_binding);
    
    // This binding also *shadows* the previous binding
    let long_lived_binding = 'a';
    
    println!("long_lived_binding outer long: {}", long_lived_binding);
}
